// Tests / Functions / Property

// th-property()
// ------------------------------

function th-property {

  @include th-assert(
    $describe: "Return property from heading"
  ){
    @include th-assert-expect {
      result: 0.55556em;
    }
    @include th-assert-actual {
      result: th-property($heading: h1, $property-name: font-size);
    }
  }

  @include th-assert(
    $describe: "Return property from heading with breakpoint"
  ){
    @include th-assert-expect {
      result: 2.77778em;
    }
    @include th-assert-actual {
      result: th-property($heading: h1, $property-name: font-size, $breakpoint: 768px);
    }
  }

  @include th-assert(
    $describe: "Return default property from heading"
  ){
    @include th-assert-expect {
      result: 3px;
    }
    @include th-assert-actual {
      result: th-property($heading: h3, $property-name: margin-top);
    }
  }

  @include th-assert(
    $describe: "Return default property from heading with breakpoint"
  ){
    @include th-assert-expect {
      result: 0.16667rem;
    }
    @include th-assert-actual {
      result: th-property($heading: h3, $property-name: margin-bottom, $breakpoint: 768px);
    }
  }

  @include th-assert(
    $describe: "Return default from heading via keyword"
  ){
    @include th-assert-expect {
      result: 3px;
    }
    @include th-assert-actual {
      result: th-property($heading: h3, $property-name: margin-top);
    }
  }

  @include th-assert(
    $describe: "Return default from heading via missing value"
  ){
    @include th-assert-expect {
      result: 0.33333;
    }
    @include th-assert-actual {
      result: th-property($heading: h5, $property-name: line-height);
    }
  }

  @include th-assert(
    $describe: "Return property from heading and unit override to percent."
  ){
    @include th-assert-expect {
      result: 55.55556%;
    }
    @include th-assert-actual {
      result: th-property($heading: h1, $property-name: font-size, $breakpoint: false, $convert: percent);
    }
  }

  @include th-assert(
    $describe: "Return property from heading and unit override to percent with base font size of 14px."
  ){
    @include th-assert-expect {
      result: 357.14286%;
    }
    @include th-assert-actual {
      result: th-property($heading: h1, $property-name: font-size, $breakpoint: 768px, $convert: percent, $base-font-size: 14px);
    }
  }

  @include th-assert(
    $describe: "Return font size from heading"
  ){
    @include th-assert-expect {
      result: 0.55556em;
    }
    @include th-assert-actual {
      result: th-property(
        $property-name: font-size,
        $heading: h1
      );
    }
  }

  @include th-assert(
    $describe: "Return font size from heading with breakpoint"
  ){
    @include th-assert-expect {
      result: 2.77778em;
    }
    @include th-assert-actual {
      result: th-property(
        $property-name: font-size,
        $heading: h1,
        $breakpoint: 768px
      );
    }
  }

  @include th-assert(
    $describe: "Return font size from heading with a single value"
  ){
    @include th-assert-expect {
      result: 0.27778em;
    }
    @include th-assert-actual {
      result: th-property(
        $property-name: font-size,
        $heading: h6
      );
    }
  }

  @include th-assert(
    $describe: "Return line height from heading"
  ){
    @include th-assert-expect {
      result: 2;
    }
    @include th-assert-actual {
      result: th-property(
        $property-name: line-height,
        $heading: h1
      );
    }
  }

  @include th-assert(
    $describe: "Return line height from heading with breakpoint"
  ){
    @include th-assert-expect {
      result: 1.2;
    }
    @include th-assert-actual {
      result: th-property(
        $property-name: line-height,
        $heading: h1,
        $breakpoint: 768px
      );
    }
  }

  @include th-assert(
    $describe: "Return margin-top from heading"
  ){
    @include th-assert-expect {
      result: 30px;
    }
    @include th-assert-actual {
      result: th-property(
        $property-name: margin-top,
        $heading: h1
      );
    }
  }

  @include th-assert(
    $describe: "Return margin-top from heading with breakpoint"
  ){
    @include th-assert-expect {
      result: 70px;
    }
    @include th-assert-actual {
      result: th-property(
        $property-name: margin-top,
        $heading: h1,
        $breakpoint: 768px
      );
    }
  }

  @include th-assert(
    $describe: "Return margin-top from heading with single value"
  ){
    @include th-assert-expect {
      result: 29px;
    }
    @include th-assert-actual {
      result: th-property(
        $property-name: margin-top,
        $heading: h2
      );
    }
  }

  @include th-assert(
    $describe: "Return margin-bottom from heading"
  ){
    @include th-assert-expect {
      result: 1.66667rem;
    }
    @include th-assert-actual {
      @include th-assert-actual {
        result: th-property(
          $property-name: margin-bottom,
          $heading: h1
        );
      }
    }
  }

  @include th-assert(
    $describe: "Return margin-bottom from heading with breakpoint"
  ){
    @include th-assert-expect {
      result: 3.33333rem;
    }
    @include th-assert-actual {
      @include th-assert-actual {
        result: th-property(
          $property-name: margin-bottom,
          $heading: h1,
          $breakpoint: 768px
        );
      }
    }
  }

  @include th-assert(
    $describe: "Return margin-bottom from heading with single value"
  ){
    @include th-assert-expect {
      result: 1.20833rem;
    }
    @include th-assert-actual {
      result: th-property(
        $property-name: margin-bottom,
        $heading: h2
      );
    }
  }

}

// _th-property-get()
// ------------------------------

function _th-property-get {

  @include th-assert(
    $describe: "Return font size property value."
  ){
    @include th-assert-expect {
      result: 10px;
    }
    @include th-assert-actual {
      result: _th-property-get((10px 20px 30px), font-size);
    }
  }

  @include th-assert(
    $describe: "Return margin top property value."
  ){
    @include th-assert-expect {
      result: 30px;
    }
    @include th-assert-actual {
      result: _th-property-get((10px 20px (30px 40px)), margin-top);
    }
  }

  @include th-assert(
    $describe: "Return margin bottom property value."
  ){
    @include th-assert-expect {
      result: 40px;
    }
    @include th-assert-actual {
      result: _th-property-get((10px 20px (30px 40px)), margin-bottom);
    }
  }

  @include th-assert(
    $describe: "Return missing value."
  ){
    @include th-assert-expect {
      result: false;
    }
    @include th-assert-actual {
      result: _th-property-get((10px 20px), margin-bottom);
    }
  }

  @include th-assert(
    $describe: "Return missing inner value."
  ){
    @include th-assert-expect {
      result: 30px;
    }
    @include th-assert-actual {
      result: _th-property-get((10px 20px 30px), margin-bottom);
    }
  }

}

// _th-property-default()
// ------------------------------

function _th-property-default {

  @include th-assert(
    $describe: "Return default font size value."
  ){
    @include th-assert-expect {
      result: 0.05556em;
    }
    @include th-assert-actual {
      result: _th-property-default(font-size);
    }
  }

}

// _th-property-unit-convert-property()
// ------------------------------

function _th-property-unit-convert-property {

  @include th-assert(
    $describe: "Convert 10px font size to em."
  ){
    @include th-assert-expect {
      result: 0.55556em;
    }
    @include th-assert-actual {
      result: _th-property-unit-convert-property(font-size, 10px);
    }
  }

  @include th-assert(
    $describe: "Convert 10px font size with base font size of 20px."
  ){
    @include th-assert-expect {
      result: 0.5em;
    }
    @include th-assert-actual {
      result: _th-property-unit-convert-property(font-size, 10px, 20px);
    }
  }

}

// th-p()
// ------------------------------

function th-p {

  @include th-assert(
  $describe: "Return property from heading"
  ){
    @include th-assert-expect {
      result: 0.55556em;
    }
    @include th-assert-actual {
      result: th-p($heading: h1, $property-name: font-size);
    }
  }

  @include th-assert(
  $describe: "Return property from heading with breakpoint"
  ){
    @include th-assert-expect {
      result: 2.77778em;
    }
    @include th-assert-actual {
      result: th-p($heading: h1, $property-name: font-size, $breakpoint: 768px);
    }
  }

  @include th-assert(
  $describe: "Return default property from heading"
  ){
    @include th-assert-expect {
      result: 3px;
    }
    @include th-assert-actual {
      result: th-p($heading: h3, $property-name: margin-top);
    }
  }

  @include th-assert(
  $describe: "Return default property from heading with breakpoint"
  ){
    @include th-assert-expect {
      result: 0.16667rem;
    }
    @include th-assert-actual {
      result: th-p($heading: h3, $property-name: margin-bottom, $breakpoint: 768px);
    }
  }

  @include th-assert(
  $describe: "Return default from heading via keyword"
  ){
    @include th-assert-expect {
      result: 3px;
    }
    @include th-assert-actual {
      result: th-p($heading: h3, $property-name: margin-top);
    }
  }

  @include th-assert(
  $describe: "Return default from heading via missing value"
  ){
    @include th-assert-expect {
      result: 0.33333;
    }
    @include th-assert-actual {
      result: th-p($heading: h5, $property-name: line-height);
    }
  }

  @include th-assert(
  $describe: "Return property from heading and unit override to percent."
  ){
    @include th-assert-expect {
      result: 55.55556%;
    }
    @include th-assert-actual {
      result: th-p($heading: h1, $property-name: font-size, $breakpoint: false, $convert: percent);
    }
  }

  @include th-assert(
  $describe: "Return property from heading and unit override to percent with base font size of 14px."
  ){
    @include th-assert-expect {
      result: 357.14286%;
    }
    @include th-assert-actual {
      result: th-p($heading: h1, $property-name: font-size, $breakpoint: 768px, $convert: percent, $base-font-size: 14px);
    }
  }

  @include th-assert(
  $describe: "Return font size from heading"
  ){
    @include th-assert-expect {
      result: 0.55556em;
    }
    @include th-assert-actual {
      result: th-p(
        $property-name: font-size,
        $heading: h1
      );
    }
  }

  @include th-assert(
  $describe: "Return font size from heading with breakpoint"
  ){
    @include th-assert-expect {
      result: 2.77778em;
    }
    @include th-assert-actual {
      result: th-p(
        $property-name: font-size,
        $heading: h1,
        $breakpoint: 768px
      );
    }
  }

  @include th-assert(
  $describe: "Return font size from heading with a single value"
  ){
    @include th-assert-expect {
      result: 0.27778em;
    }
    @include th-assert-actual {
      result: th-p(
        $property-name: font-size,
        $heading: h6
      );
    }
  }

  @include th-assert(
  $describe: "Return line height from heading"
  ){
    @include th-assert-expect {
      result: 2;
    }
    @include th-assert-actual {
      result: th-p(
        $property-name: line-height,
        $heading: h1
      );
    }
  }

  @include th-assert(
  $describe: "Return line height from heading with breakpoint"
  ){
    @include th-assert-expect {
      result: 1.2;
    }
    @include th-assert-actual {
      result: th-p(
        $property-name: line-height,
        $heading: h1,
        $breakpoint: 768px
      );
    }
  }

  @include th-assert(
  $describe: "Return margin-top from heading"
  ){
    @include th-assert-expect {
      result: 30px;
    }
    @include th-assert-actual {
      result: th-p(
        $property-name: margin-top,
        $heading: h1
      );
    }
  }

  @include th-assert(
  $describe: "Return margin-top from heading with breakpoint"
  ){
    @include th-assert-expect {
      result: 70px;
    }
    @include th-assert-actual {
      result: th-p(
        $property-name: margin-top,
        $heading: h1,
        $breakpoint: 768px
      );
    }
  }

  @include th-assert(
  $describe: "Return margin-top from heading with single value"
  ){
    @include th-assert-expect {
      result: 29px;
    }
    @include th-assert-actual {
      result: th-p(
        $property-name: margin-top,
        $heading: h2
      );
    }
  }

  @include th-assert(
  $describe: "Return margin-bottom from heading"
  ){
    @include th-assert-expect {
      result: 1.66667rem;
    }
    @include th-assert-actual {
      @include th-assert-actual {
        result: th-p(
          $property-name: margin-bottom,
          $heading: h1
        );
      }
    }
  }

  @include th-assert(
  $describe: "Return margin-bottom from heading with breakpoint"
  ){
    @include th-assert-expect {
      result: 3.33333rem;
    }
    @include th-assert-actual {
      @include th-assert-actual {
        result: th-p(
          $property-name: margin-bottom,
          $heading: h1,
          $breakpoint: 768px
        );
      }
    }
  }

  @include th-assert(
  $describe: "Return margin-bottom from heading with single value"
  ){
    @include th-assert-expect {
      result: 1.20833rem;
    }
    @include th-assert-actual {
      result: th-p(
        $property-name: margin-bottom,
        $heading: h2
      );
    }
  }

}